<template>
    <div class="login-container">
      <div class="login-form">
        <h2>Welcome Back</h2>
        <p>Please log in to your account</p>
        
        <form @submit.prevent="handleLogin">
          <div class="input-group">
            <label for="username">Username</label>
            <input type="text" id="username" v-model="username" placeholder="Enter your username" />
          </div>
  
          <div class="input-group">
            <label for="password">Password</label>
            <input type="password" id="password" v-model="password" placeholder="Enter your password" />
          </div>
  
          <button type="submit" class="login-button">Log In</button>
        </form>
      </div>
    </div>
  </template>
  
  <script setup>
  import { ref } from 'vue';
  
  const username = ref('');
  const password = ref('');
  
  const handleLogin = () => {
    // 登录逻辑（例如 API 调用）
    console.log("Logging in with", username.value, password.value);
  };
  </script>
  
  <style scoped>
  /* 页面居中布局 */
  .login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
  }
  
  /* 表单样式 */
  .login-form {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    max-width: 360px;
  }
  
  .login-form h2 {
    margin: 0;
    color: #333;
  }
  
  .login-form p {
    color: #666;
    margin-bottom: 1.5rem;
  }
  
  .input-group {
    margin-bottom: 1rem;
    text-align: left;
  }
  
  .input-group label {
    display: block;
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.5rem;
  }
  
  .input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s ease;
  }
  
  .input-group input:focus {
    border-color: #6e8efb;
    outline: none;
  }
  
  .login-button {
    width: 100%;
    padding: 0.75rem;
    background-color: #6e8efb;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
  }
  
  .login-button:hover {
    background-color: #5a7ddb;
  }
  </style>
  